<% layout('/layouts/default.html', {title: '数据管理', libs:
['validate','fileupload','ueditor','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(ztCompany.isNewRecord ? '新增公司信息' :
				'编辑公司信息')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool"
					data-widget="collapse">
					<i class="fa fa-minus"></i>
				</button>
			</div>
		</div>
		
		<#form:form id="inputForm" model="${ztCompany}"
		action="${ctx}/ztCompany/save" method="post" class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('公司信息')}</div>
			<#form:hidden path="id"/>
			<input type="hidden" name="oldCompany" value="${ztCompany.company}"/>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('公司名')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="companyname"
							maxlength="30" class="form-control required"/></div>
					</div>
				</div>
				
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('公司编号')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:hidden path="company"/>
							<#form:input path="company"  disabled="disabled" class="form-control required"/></div>
					</div>
				</div>
				
			</div>
			
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('公司地址')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="addr"
						 class="form-control"/></div>
					</div>
				</div>
				
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('联系人号码')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="phone"
							onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');"
							maxlength="20" class="form-control"/></div>
					</div>
				</div>
				
			</div>
			
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('联系人')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="name"
						 class="form-control"/></div>
					</div>
				</div>
				
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required"></span> ${text('类型')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
					
							<#form:select path="goodscode" 
							multiple="true" 
							items="${goodscodeList}" itemLabel="name" itemValue="viewCode"
							blankOption="true" class="form-control "/>
							
							</div>
					</div>
				</div>
				
			</div>

		</div>
		<div class="box-footer">
			<div class="row">
				<div class="col-sm-offset-2 col-sm-10">
					<% if (hasPermi('ztCompany:ztCompanyData:edit')){ %>
					<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit">
						<i class="fa fa-check"></i> ${text('保 存')}
					</button>
					&nbsp; <% } %>
					<button type="button" class="btn btn-sm btn-default" id="btnCancel"
						onclick="js.closeCurrentTabPage()">
						<i class="fa fa-reply-all"></i> ${text('关 闭')}
					</button>
				</div>
			</div>
		</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
	$("#inputForm").validate({
		submitHandler : function(form) {
			js.ajaxSubmitForm($(form), function(data) {
				js.showMessage(data.message);
				if (data.result == Global.TRUE) {
					js.closeCurrentTabPage(function(contentWindow) {
						contentWindow.page();
					});
				}
			}, "json");
		}
	});
</script>